home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performNurbsPlane.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  18.0 KB  |  717 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  6 May 1997
  22. //  Author:         mm
  23. //
  24. //  Description:
  25. //    This script defines the option box for the NURBS plane menu item.
  26. //
  27.  
  28.  
  29. //
  30. //  Procedure Name:
  31. //      setOptionVars
  32. //
  33. //  Description:
  34. //        Initialize the option values.
  35. //
  36. //  Input Arguments:
  37. //        Whether to set the options to default values.
  38. //
  39. //  Return Value:
  40. //      None.
  41. //
  42. proc setOptionVars(int $forceFactorySettings)
  43. {
  44.     if ($forceFactorySettings ||  !`optionVar -exists nurbsPlanePivotType`) {
  45.         optionVar -intValue nurbsPlanePivotType 1;
  46.     }
  47.  
  48.     if ($forceFactorySettings ||  !`optionVar -exists nurbsPlanePivotX`) {
  49.         optionVar -floatValue nurbsPlanePivotX 0.0;
  50.     }
  51.     if ($forceFactorySettings ||  !`optionVar -exists nurbsPlanePivotY`) {
  52.         optionVar -floatValue nurbsPlanePivotY 0.0;
  53.     }
  54.     if ($forceFactorySettings ||  !`optionVar -exists nurbsPlanePivotZ`) {
  55.         optionVar -floatValue nurbsPlanePivotZ 0.0;
  56.     }
  57.  
  58.  
  59.  
  60.     string $isitYup = `upAxis -q -ax`;
  61.     if( "y" == $isitYup ) {
  62.         if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneAxisType`) {
  63.             optionVar -intValue nurbsPlaneAxisType 2;
  64.         }
  65.  
  66.         if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneAxisX`) {
  67.             optionVar -floatValue nurbsPlaneAxisX 0.0;
  68.         }
  69.         
  70.         if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneAxisY`) {
  71.             optionVar -floatValue nurbsPlaneAxisY 1.0;
  72.         }
  73.         if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneAxisZ`) {
  74.             optionVar -floatValue nurbsPlaneAxisZ 0.0;
  75.         }
  76.     }
  77.     else {
  78.         if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneAxisType`) {
  79.             optionVar -intValue nurbsPlaneAxisType 3;
  80.         }
  81.  
  82.         if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneAxisX`) {
  83.             optionVar -floatValue nurbsPlaneAxisX 0.0;
  84.         }
  85.         if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneAxisY`) {
  86.             optionVar -floatValue nurbsPlaneAxisY 0.0;
  87.         }
  88.         if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneAxisZ`) {
  89.             optionVar -floatValue nurbsPlaneAxisZ 1.0;
  90.         }
  91.     }
  92.  
  93.  
  94.     if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneWidth`) {
  95.         optionVar -floatValue nurbsPlaneWidth 1.0;
  96.     }
  97.     if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneLengthRatio`) {
  98.         optionVar -floatValue nurbsPlaneLengthRatio 1.0;
  99.     }
  100.  
  101.  
  102.  
  103.     if ($forceFactorySettings ||  !`optionVar -exists nurbsPlaneDegree`) {
  104.         optionVar -intValue nurbsPlaneDegree 3;
  105.     }
  106.  
  107.  
  108.  
  109.     if ($forceFactorySettings ||  !`optionVar -exists nurbsPlanePatchesU`) {
  110.         optionVar -intValue nurbsPlanePatchesU 1;
  111.     }
  112.     if ($forceFactorySettings ||  !`optionVar -exists nurbsPlanePatchesV`) {
  113.         optionVar -intValue nurbsPlanePatchesV 1;
  114.     }
  115. }
  116.  
  117. //
  118. //  Procedure Name:
  119. //      nurbsPlaneSetup
  120. //
  121. //  Description:
  122. //        Update the state of the option box UI to reflect the option values.
  123. //
  124. //  Input Arguments:
  125. //      parent               - Top level parent layout of the option box UI.
  126. //                             Required so that UI object names can be 
  127. //                             successfully resolved.
  128. //
  129. //    forceFactorySettings - Whether the option values should be set to
  130. //                             default values.
  131. //
  132. //  Return Value:
  133. //      None.
  134. //
  135. global proc nurbsPlaneSetup(string $parent, int $forceFactorySettings)
  136. {
  137.     //    Retrieve the option settings
  138.     //
  139.     setOptionVars($forceFactorySettings);
  140.  
  141.     setParent $parent;
  142.  
  143.     //    Query the optionVar's and set the values into the controls.
  144.  
  145.     // Pivot
  146.     //
  147.     int $pivotType = `optionVar -q nurbsPlanePivotType`;
  148.     float $pivotX = `optionVar -q nurbsPlanePivotX`;
  149.     float $pivotY = `optionVar -q nurbsPlanePivotY`;
  150.     float $pivotZ = `optionVar -q nurbsPlanePivotZ`;
  151.     if ($pivotType == 1) {
  152.         $pivotX = 0;
  153.         $pivotY = 0;
  154.         $pivotZ = 0;
  155.     }
  156.     radioButtonGrp -e -select $pivotType nurbsPlanePivotType;
  157.     floatFieldGrp -e
  158.         -v1 $pivotX -v2 $pivotY -v3 $pivotZ
  159.         nurbsPlanePivot;
  160.  
  161.     // Axis
  162.     //
  163.     int $axisType = `optionVar -q nurbsPlaneAxisType`;
  164.     float $axis[3];
  165.     switch($axisType) {
  166.       case 1:
  167.         $axis[0] = 1;
  168.         $axis[1] = 0;
  169.         $axis[2] = 0;
  170.         break;
  171.       case 2:
  172.         $axis[0] = 0;
  173.         $axis[1] = 1;
  174.         $axis[2] = 0;
  175.         break;
  176.       case 3:
  177.         $axis[0] = 0;
  178.         $axis[1] = 0;
  179.         $axis[2] = 1;
  180.         break;
  181.       case 4:
  182.         $axis[0] = `optionVar -q nurbsPlaneAxisX`;
  183.         $axis[1] = `optionVar -q nurbsPlaneAxisY`;
  184.         $axis[2] = `optionVar -q nurbsPlaneAxisZ`;
  185.         break;
  186.       case 5:
  187.         $axis = `nurbsViewDirectionVector 1`;
  188.         break;
  189.     }
  190.     if( $axisType < 4 ) {
  191.         radioButtonGrp -e -select $axisType nurbsPlaneAxisType1;
  192.     }
  193.     else {
  194.         radioButtonGrp -e -select ($axisType - 3) nurbsPlaneAxisType2;
  195.     }
  196.     floatFieldGrp -e
  197.         -v1 $axis[0] -v2 $axis[1] -v3 $axis[2]
  198.         nurbsPlaneAxis;
  199.  
  200.     // Width
  201.     //
  202.     float $planeWidth = `optionVar -q nurbsPlaneWidth`;
  203.     floatSliderGrp -e
  204.         -v $planeWidth
  205.         nurbsPlaneWidth;
  206.  
  207.     // Length Ratio
  208.     //
  209.     float $ratio = `optionVar -q nurbsPlaneLengthRatio`;
  210.     floatSliderGrp -e
  211.         -v `nurbsRatioConvert $planeWidth $ratio false`
  212.         nurbsPlaneLength;
  213.  
  214.     // Degree
  215.     //
  216.     int $degree = `optionVar -q nurbsPlaneDegree`;
  217.     int $degreeBtn;
  218.     switch($degree) {
  219.         case 1: radioButtonGrp -e -select 1 nurbsPlaneDegree123; break;
  220.         case 2: radioButtonGrp -e -select 2 nurbsPlaneDegree123; break;
  221.         case 3: radioButtonGrp -e -select 3 nurbsPlaneDegree123; break;
  222.         case 5: radioButtonGrp -e -select 1 nurbsPlaneDegree57; break;
  223.         case 7: radioButtonGrp -e -select 2 nurbsPlaneDegree57; break;
  224.         default: radioButtonGrp -e -select 3 nurbsPlaneDegree123; break;
  225.     }
  226.  
  227.     // Patches U
  228.     //
  229.     intSliderGrp -e
  230.         -v `optionVar -q nurbsPlanePatchesU`
  231.         nurbsPlanePatchesU;
  232.  
  233.     // Patches V
  234.     //
  235.     intSliderGrp -e
  236.         -v `optionVar -q nurbsPlanePatchesV`
  237.         nurbsPlanePatchesV;
  238.  
  239.     // Disable or enable some controls depending on other values.
  240.     //
  241.     if ($pivotType == 2)
  242.         floatFieldGrp -e -enable 1 nurbsPlanePivot;
  243.     else
  244.         floatFieldGrp -e -enable 0 nurbsPlanePivot;
  245.  
  246.     if ($axisType == 4)
  247.         floatFieldGrp -e -enable 1 nurbsPlaneAxis;
  248.     else
  249.         floatFieldGrp -e -enable 0 nurbsPlaneAxis;
  250. }
  251.  
  252. //
  253. //  Procedure Name:
  254. //      nurbsPlaneCallback
  255. //
  256. //  Description:
  257. //        Update the option values with the current state of the option box UI.
  258. //
  259. //  Input Arguments:
  260. //      parent - Top level parent layout of the option box UI.  Required so
  261. //               that UI object names can be successfully resolved.
  262. //
  263. //    doIt   - Whether the command should execute.
  264. //
  265. //  Return Value:
  266. //      None.
  267. //
  268. global proc nurbsPlaneCallback(string $parent, int $doIt)
  269. {
  270.     setParent $parent;
  271.  
  272.     //    Set the optionVar's from the control values, and then
  273.     //    perform the command.
  274.  
  275.     // Pivot
  276.     //
  277.     int $pivotType = `radioButtonGrp -q -select nurbsPlanePivotType`;
  278.     optionVar -intValue nurbsPlanePivotType $pivotType;
  279.     if ($pivotType == 2) {
  280.         optionVar -floatValue nurbsPlanePivotX `floatFieldGrp -q -v1 nurbsPlanePivot`;
  281.         optionVar -floatValue nurbsPlanePivotY `floatFieldGrp -q -v2 nurbsPlanePivot`;
  282.         optionVar -floatValue nurbsPlanePivotZ `floatFieldGrp -q -v3 nurbsPlanePivot`;
  283.     }
  284.  
  285.     // Axis
  286.     //
  287.     int $axisType = `radioButtonGrp -q -select nurbsPlaneAxisType1`;
  288.     if( 0 == $axisType ) {
  289.         $axisType = `radioButtonGrp -q -select nurbsPlaneAxisType2` + 3;
  290.     }
  291.     optionVar -intValue nurbsPlaneAxisType $axisType;
  292.     if( ($axisType == 4) || (5 == $axisType) ) {
  293.         optionVar -floatValue nurbsPlaneAxisX `floatFieldGrp -q -v1 nurbsPlaneAxis`;
  294.         optionVar -floatValue nurbsPlaneAxisY `floatFieldGrp -q -v2 nurbsPlaneAxis`;
  295.         optionVar -floatValue nurbsPlaneAxisZ `floatFieldGrp -q -v3 nurbsPlaneAxis`;
  296.     }
  297.  
  298.     // Width
  299.     //
  300.     float $planeWidth = `floatSliderGrp -q -v nurbsPlaneWidth`;
  301.     optionVar -floatValue nurbsPlaneWidth
  302.         $planeWidth;
  303.  
  304.     // Length Ratio
  305.     //
  306.     float $ratio = `floatSliderGrp -q -v nurbsPlaneLength`;
  307.     optionVar -floatValue nurbsPlaneLengthRatio
  308.         `nurbsRatioConvert $planeWidth $ratio true`;
  309.  
  310.     // Degree
  311.     //
  312.     int $degreeBtn123 = `radioButtonGrp -q -select nurbsPlaneDegree123`;
  313.     int $degreeBtn57 = `radioButtonGrp -q -select nurbsPlaneDegree57`;
  314.     int $degree;
  315.     switch($degreeBtn123) {
  316.         case 1: $degree = 1; break;
  317.         case 2: $degree = 2; break;
  318.         case 3: $degree = 3; break;
  319.         default:
  320.             switch($degreeBtn57) {
  321.                 case 1: $degree = 5; break;
  322.                 case 2: $degree = 7; break;
  323.                 default: $degree = 3; break;
  324.             }
  325.             break;
  326.     }
  327.     optionVar -intValue nurbsPlaneDegree
  328.         $degree;
  329.  
  330.     // Patches U
  331.     //
  332.     optionVar -intValue nurbsPlanePatchesU
  333.         `intSliderGrp -q -v nurbsPlanePatchesU`;
  334.  
  335.     // Patches V
  336.     //
  337.     optionVar -intValue nurbsPlanePatchesV
  338.         `intSliderGrp -q -v nurbsPlanePatchesV`;
  339.  
  340.     if ($doIt) {
  341.         performNurbsPlane 0; 
  342.         addToRecentCommandQueue "performNurbsPlane 0" "NURBS Plane";
  343.     }
  344. }
  345.  
  346. //
  347. //  Procedure Name:
  348. //      nurbsPlaneOptions
  349. //
  350. //  Description:
  351. //        Construct the option box UI.  Involves accessing the standard option
  352. //        box and customizing the UI accordingly.
  353. //
  354. //  Input Arguments:
  355. //      None.
  356. //
  357. //  Return Value:
  358. //      None.
  359. //
  360. proc nurbsPlaneOptions()
  361. {
  362.     //    Name of the command for this option box.
  363.     //
  364.     string $commandName = "nurbsPlane";
  365.  
  366.     //    Build the option box actions.
  367.     //
  368.     string $callback = ($commandName + "Callback");
  369.     string $setup = ($commandName + "Setup");
  370.  
  371.     //    STEP 1:  Get the option box.
  372.     //    ============================
  373.     //
  374.     //    The value returned is the name of the layout to be used as
  375.     //    the parent for the option box UI.
  376.     //
  377.     string $layout = getOptionBox();
  378.     setParent $layout;
  379.     
  380.     //    STEP 2:  Pass the command name to the option box.
  381.     //    =================================================
  382.     //
  383.     //    Any default option box behaviour based on the command name is set 
  384.     //    up with this call.  For example, updating the 'Help' menu item with
  385.     //    the name of the command.
  386.     //
  387.     setOptionBoxCommandName($commandName);
  388.     
  389.     //    STEP 3:  Activate the default UI template.
  390.     //    ==========================================
  391.     //
  392.     //    Activate the default UI template so that the layout of this 
  393.     //    option box is consistent with the layout of the rest of the 
  394.     //    application.
  395.     //
  396.     setUITemplate -pushTemplate DefaultTemplate;
  397.  
  398.     //    Turn on the wait cursor.
  399.     //
  400.     waitCursor -state 1;
  401.  
  402.     //    STEP 4: Create option box contents.
  403.     //    ===================================
  404.     //
  405.     tabLayout -scr true -tv false;
  406.     string $parent = `columnLayout -adjustableColumn 1`;
  407.  
  408.     radioButtonGrp -label "Pivot"
  409.         -numberOfRadioButtons 2
  410.         -l1 "Object"
  411.         -l2 "User Defined"
  412.         -select 1
  413.         nurbsPlanePivotType;
  414.  
  415.     floatFieldGrp -label "Pivot Point"
  416.         -numberOfFields 3
  417.         nurbsPlanePivot;
  418.  
  419.     radioButtonGrp -label "Axis"
  420.         -numberOfRadioButtons 3
  421.         -l1 "X"
  422.         -l2 "Y"
  423.         -l3 "Z"
  424.         -select 1
  425.         nurbsPlaneAxisType1;
  426.  
  427.     radioButtonGrp
  428.         -numberOfRadioButtons 2
  429.         -l1 "Free"
  430.         -l2 "Active View"
  431.         -scl "nurbsPlaneAxisType1"
  432.         nurbsPlaneAxisType2;
  433.  
  434.     floatFieldGrp -label "Axis Definition"
  435.         -numberOfFields 3
  436.         nurbsPlaneAxis;
  437.  
  438.     separator;
  439.  
  440.     floatSliderGrp -label "Width"
  441.         -fmn 0.0001 -min 0.0001
  442.         -fmx 1000 -max 100
  443.         nurbsPlaneWidth;
  444.  
  445.     floatSliderGrp -label "Length"
  446.         -fmn 0 -min 0
  447.         -fmx 1000 -max 100
  448.         nurbsPlaneLength;
  449.  
  450.     radioButtonGrp -label "Surface Degree"
  451.         -numberOfRadioButtons 3
  452.         -l1 "1 Linear"
  453.         -l2 "2" // Quadratic
  454.         -l3 "3 Cubic"
  455.         -select 3
  456.         nurbsPlaneDegree123;
  457.  
  458.     radioButtonGrp -shareCollection nurbsPlaneDegree123
  459.         -numberOfRadioButtons 2
  460.         -l1 "5" // Quintic
  461.         -l2 "7"
  462.         nurbsPlaneDegree57;
  463.  
  464.     intSliderGrp -l "U Patches"
  465.         -field true
  466.         -min 1
  467.         -fmx 500 -max 100
  468.         nurbsPlanePatchesU;
  469.  
  470.     intSliderGrp -l "V Patches"
  471.         -field true
  472.         -min 1
  473.         -fmx 500 -max 100
  474.         nurbsPlanePatchesV;
  475.  
  476.     // Set the pivot float fields to only be enabled when "Pivot" is "User Defined"
  477.     //
  478.     string $pivotEnable = ("floatFieldGrp -e -en 1 nurbsPlanePivot;"
  479.         + "floatFieldGrp -e"
  480.         + " -v1 `optionVar -q nurbsPlanePivotX`"
  481.         + " -v2 `optionVar -q nurbsPlanePivotY`"
  482.         + " -v3 `optionVar -q nurbsPlanePivotZ`"
  483.         + " nurbsPlanePivot;"
  484.         );
  485.     string $pivotDisable = "floatFieldGrp -e -en 0 nurbsPlanePivot;";
  486.     radioButtonGrp -edit
  487.         -cc1 ($pivotDisable + "floatFieldGrp -e -value 0.0 0.0 0.0 0.0 nurbsPlanePivot;")
  488.         -cc2 $pivotEnable
  489.         nurbsPlanePivotType;
  490.  
  491.     // Set the axis float fields to only be enabled when "Axis Preset" is "Free"
  492.     //
  493.     string $axisEnable = ("floatFieldGrp -e -en 1 nurbsPlaneAxis;"
  494.         + "floatFieldGrp -e"
  495.         + " -v1 `optionVar -q nurbsPlaneAxisX`"
  496.         + " -v2 `optionVar -q nurbsPlaneAxisY`"
  497.         + " -v3 `optionVar -q nurbsPlaneAxisZ`"
  498.         + " nurbsPlaneAxis;"
  499.         );
  500.     string $axisDisable = "floatFieldGrp -e -en 0 nurbsPlaneAxis;";
  501.     radioButtonGrp -edit
  502.         -cc1 ($axisDisable + "floatFieldGrp -e -value 1.0 0.0 0.0 0.0 nurbsPlaneAxis;")
  503.         -cc2 ($axisDisable + "floatFieldGrp -e -value 0.0 1.0 0.0 0.0 nurbsPlaneAxis;")
  504.         -cc3 ($axisDisable + "floatFieldGrp -e -value 0.0 0.0 1.0 0.0 nurbsPlaneAxis;")
  505.         nurbsPlaneAxisType1;
  506.     radioButtonGrp -edit
  507.         -cc1 $axisEnable
  508.         -cc2 $axisDisable
  509.         nurbsPlaneAxisType2;
  510.  
  511.     //    Turn off the wait cursor.
  512.     //
  513.     waitCursor -state 0;
  514.     
  515.     //    Step 5: Deactivate the default UI template.
  516.     //      ===========================================
  517.     //
  518.     setUITemplate -popTemplate;
  519.  
  520.     //    Step 6: Customize the buttons.  
  521.     //    ==============================
  522.     //
  523.     //    Provide more descriptive labels for the buttons.
  524.     //    Disable those buttons that are not applicable to the option box.
  525.     //    Attach actions to those buttons that are applicable to the option box.
  526.  
  527.     //    'Apply' button.
  528.     //
  529.     string $applyBtn = getOptionBoxApplyBtn();
  530.     button -edit
  531.         -label "Create"
  532.         -command ($callback + " " + $parent + " " + 1)
  533.         $applyBtn;
  534.  
  535.     //    'Save' button.
  536.     //
  537.     string $saveBtn = getOptionBoxSaveBtn();
  538.     button -edit 
  539.         -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
  540.         $saveBtn;
  541.  
  542.     //    'Reset' button.
  543.     //
  544.     string $resetBtn = getOptionBoxResetBtn();
  545.     button -edit 
  546.         -command ($setup + " " + $parent + " " + 1)
  547.         $resetBtn;
  548.  
  549.     //    Step 7: Set the option box title.
  550.     //    =================================
  551.     //
  552.     setOptionBoxTitle("NURBS Plane Options");
  553.  
  554.     //    Step 8: Customize the 'Help' menu item text.
  555.     //    ============================================
  556.     //
  557.     setOptionBoxHelpTag( "NurbsPlane" );
  558.  
  559.     //    Set the current values of the option box.
  560.     //    =========================================
  561.     //
  562.     eval (($setup + " " + $parent + " " + 0));    
  563.     
  564.     //    Show the option box.
  565.     //    ====================
  566.     //
  567.     showOptionBox();
  568. }
  569.  
  570. //
  571. //  Procedure Name:
  572. //      nurbsPlaneHelp
  573. //
  574. //  Description:
  575. //        Return a short description about this command.
  576. //
  577. //  Input Arguments:
  578. //      None.
  579. //
  580. //  Return Value:
  581. //      string.
  582. //
  583. proc string nurbsPlaneHelp()
  584. {
  585.     return 
  586.     "  Command: nurbsPlane - create a NURBS plane.\n";
  587. }
  588.  
  589. //
  590. //  Procedure Name:
  591. //      assembleCmd
  592. //
  593. //  Description:
  594. //        Construct the command that will apply the option box values.
  595. //
  596. //  Input Arguments:
  597. //      None.
  598. //
  599. proc string assembleCmd()
  600. {
  601.     string $cmd = "nurbsPlane";
  602.  
  603.     setOptionVars(false);
  604.  
  605.     int $pivotType = `optionVar -q nurbsPlanePivotType`;
  606.     float $pivotX = `optionVar -q nurbsPlanePivotX`;
  607.     float $pivotY = `optionVar -q nurbsPlanePivotY`;
  608.     float $pivotZ = `optionVar -q nurbsPlanePivotZ`;
  609.     if ($pivotType == 1) {
  610.         $pivotX = 0;
  611.         $pivotY = 0;
  612.         $pivotZ = 0;
  613.     }
  614.  
  615.     // Axis
  616.     //
  617.     int $axisType = `optionVar -q nurbsPlaneAxisType`;
  618.     float $axis[3];
  619.     switch($axisType) {
  620.       case 1:
  621.         $axis[0] = 1;
  622.         $axis[1] = 0;
  623.         $axis[2] = 0;
  624.         break;
  625.       case 2:
  626.         $axis[0] = 0;
  627.         $axis[1] = 1;
  628.         $axis[2] = 0;
  629.         break;
  630.       case 3:
  631.         $axis[0] = 0;
  632.         $axis[1] = 0;
  633.         $axis[2] = 1;
  634.         break;
  635.       case 4:
  636.         $axis[0] = `optionVar -q nurbsPlaneAxisX`;
  637.         $axis[1] = `optionVar -q nurbsPlaneAxisY`;
  638.         $axis[2] = `optionVar -q nurbsPlaneAxisZ`;
  639.         break;
  640.       case 5:
  641.         $axis = `nurbsViewDirectionVector 1`;
  642.         break;
  643.     }
  644.  
  645.     // History
  646.     //
  647.     int $doHistory = `constructionHistory -q -toggle`;
  648.  
  649.     $cmd = ($cmd
  650.         + " -p " + $pivotX + " " + $pivotY + " " + $pivotZ
  651.         + " -ax " + $axis[0] + " " + $axis[1] + " " + $axis[2]
  652.         + " -w " + `optionVar -query nurbsPlaneWidth`
  653.         + " -lr " + `optionVar -query nurbsPlaneLengthRatio`
  654.         + " -d " + `optionVar -query nurbsPlaneDegree`
  655.         + " -u " + `optionVar -query nurbsPlanePatchesU`
  656.         + " -v " + `optionVar -query nurbsPlanePatchesV`
  657.         + " -ch " + $doHistory
  658.         + "; objectMoveCommand");
  659.  
  660.     return $cmd;
  661. }
  662.  
  663. //
  664. //  Procedure Name:
  665. //      performNurbsPlane
  666. //
  667. //  Description:
  668. //        Perform the nurbsPlane command using the corresponding 
  669. //        option values.  This procedure will also show the option box
  670. //        window if necessary as well as construct the command string
  671. //        that will invoke the nurbsPlane command with the current
  672. //        option box values.
  673. //
  674. //  Input Arguments:
  675. //      0 - Execute the command.
  676. //      1 - Show the option box dialog.
  677. //      2 - Return the command.
  678. //
  679. //  Return Value:
  680. //      None.
  681. //
  682. global proc string performNurbsPlane(int $action)
  683. {
  684.     string $cmd = "";
  685.  
  686.     switch ($action) {
  687.  
  688.         //    Execute the command.
  689.         //
  690.         case 0:
  691.             //    Get the command.
  692.             //
  693.             $cmd = `assembleCmd`;
  694.  
  695.             //    Execute the command with the option settings.
  696.             //
  697.             evalEcho($cmd);
  698.  
  699.             break;
  700.  
  701.         //    Show the option box.
  702.         //
  703.         case 1:
  704.             nurbsPlaneOptions;
  705.             break;
  706.  
  707.         //    Return the command string.
  708.         //
  709.         case 2:
  710.             //    Get the command.
  711.             //
  712.             $cmd = `assembleCmd`;
  713.             break;
  714.     }
  715.     return $cmd;
  716. }
  717.